﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Sage.DownloadLite.Core
{
    /// <summary>
    /// 调试日志工具类
    /// </summary>
    internal static class DebugLogger
    {
        /// <summary>
        /// 是否启用调试输出
        /// </summary>
        public static bool Enabled { get; set; } = false;
        /// <summary>
        /// 写入调试消息
        /// </summary>
        /// <param name="source">消息来源</param>
        /// <param name="message">消息内容</param>
        public static void WriteMessage(string source, string message)
        {
            if (!Enabled) return;
            var logMessage = $"[{source}] {message}";
            System.Diagnostics.Debug.WriteLine(logMessage);
            Console.WriteLine(logMessage);
        }
    }
}
